package com.pixiv.Entity;

import com.pixiv.service.AuditTitleService;
import com.pixiv.service.TitleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

@Scope("prototype")
@Component
public class AuditTitlePicture {
    private String auditTitleUUID;
    private String auditTitleCaption;
    private String auditTitleContext;
    private String auditTitleLabel;
    private int auditAgeLimit;
    private int auditOrginal;
    private String auditUploadTime;
    private int userid;

    @Autowired
    JdbcTemplate jdbcTemplate;


    public String getAuditTitleUUID() {
        return auditTitleUUID;
    }

    public void setAuditTitleUUID(String auditTitleUUID) {
        this.auditTitleUUID = auditTitleUUID;
    }

    public String getAuditTitleCaption() {
        return auditTitleCaption;
    }

    public void setAuditTitleCaption(String auditTitleCaption) {
        this.auditTitleCaption = auditTitleCaption;
    }

    public String getAuditTitleContext() {
        return auditTitleContext;
    }

    public void setAuditTitleContext(String auditTitleContext) {
        this.auditTitleContext = auditTitleContext;
    }

    public String getAuditTitleLabel() {
        return auditTitleLabel;
    }

    public void setAuditTitleLabel(String auditTitleLabel) {
        this.auditTitleLabel = auditTitleLabel;
    }

    public int getAuditAgeLimit() {
        return auditAgeLimit;
    }

    public void setAuditAgeLimit(int auditAgeLimit) {
        this.auditAgeLimit = auditAgeLimit;
    }

    public int getAuditOrginal() {
        return auditOrginal;
    }

    public void setAuditOrginal(int auditOrginal) {
        this.auditOrginal = auditOrginal;
    }

    public String getAuditUploadTime() {
        return auditUploadTime;
    }

    public void setAuditUploadTime(String auditUploadTime) {
        this.auditUploadTime = auditUploadTime;
    }

    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    @Override
    public String toString(){
        return "uuid:" + auditTitleUUID + ",caption:" + auditTitleCaption + ",context:" + auditTitleContext;
    }

    public void approvedTitle(TitleService titleService){

        titleService.approved(getAuditTitleUUID(),
                getAuditTitleCaption(),
                getAuditTitleContext(),
                getAuditTitleLabel(),
                getAuditAgeLimit(),
                getAuditOrginal(),
                getAuditUploadTime(),
                getUserid());
    }
    public void approvedPicture(TitleService titleService){
        titleService.approvedPicture(getAuditTitleUUID(),userid);
    }
    public void deleteAuditData(AuditTitleService auditTitleService){
        auditTitleService.delAuditTitle(auditTitleUUID);
        auditTitleService.delAuditPicture(auditTitleUUID);
    }


}
